﻿using Little.Soldier.SWIFT;
using Little.Soldier.SWIFT.Definition;
using System.Collections.Generic;
using System.ComponentModel;

namespace Little.Soldier.SWIFT.Messages.Category0
{
  public class MT052 : SwiftMessage
  {
    private static SwiftMessageDefinition MessageDefinition;
    private static SwiftTagChoiceDefinition U0002;
    private static SwiftTagSequenceDefinition U0003;
    private static SwiftTagDefinition U0004;
    private static SwiftTagSubItemDefinition U0005;
    private static SwiftTagSubItemDefinition U0006;
    private static SwiftTagSubItemDefinition U0007;
    private static SwiftTagDefinition U0008;
    private static SwiftTagSubItemDefinition U000E;

    [Description("")]
    public MT052.DeliverySubsetStatus_336Class DeliverySubsetStatus_336
    {
      get
      {
        return new MT052.DeliverySubsetStatus_336Class((SwiftElement) this, 0, false);
      }
    }

    [Description("Empty Report")]
    public Tag461 EmptyReport_461
    {
      get
      {
        return new Tag461((SwiftElement) this, 0, (SwiftDefinitionElement) MT052.U0008);
      }
    }

    [Description("Empty Report")]
    public Tag461 Tag461_EmptyReport
    {
      get
      {
        return this.EmptyReport_461;
      }
    }

    public MT052()
      : base(true)
    {
    }

    public MT052(SwiftMessage message)
      : base(message)
    {
    }

    internal override SwiftMessageDefinition MsgDefinition()
    {
      return MT052.MessageDefinition;
    }

    protected override void InitSwiftMessageDefinition()
    {
      MT052.MessageDefinition = new SwiftMessageDefinition("MT052", "");
      MT052.U0002 = new SwiftTagChoiceDefinition("Choice", "");
      MT052.U0002.Multiple = true;
      MT052.U0003 = new SwiftTagSequenceDefinition("DeliverySubsetStatus_336", "");
      MT052.U0004 = new SwiftTagDefinition("DeliverySubsetStatus_336_1", "");
      MT052.U0004.TagName = "{336:";
      MT052.U0004.Multiple = true;
      MT052.U0005 = new SwiftTagSubItemDefinition("DeliverySubsetName", "Delivery Subset Name");
      MT052.U0004.Elements.Add((SwiftDefinitionElement) MT052.U0005);
      MT052.U0006 = new SwiftTagSubItemDefinition("Count", "Count");
      MT052.U0004.Elements.Add((SwiftDefinitionElement) MT052.U0006);
      MT052.U0007 = new SwiftTagSubItemDefinition("LTCode", "Lt Code");
      MT052.U0007.Mandatory = false;
      MT052.U0004.Elements.Add((SwiftDefinitionElement) MT052.U0007);
      MT052.U0003.Elements.Add((SwiftDefinitionElement) MT052.U0004);
      MT052.U0002.Elements.Add((SwiftDefinitionElement) MT052.U0003);
      MT052.U0008 = new SwiftTagDefinition("EmptyReport_461", "Empty Report");
      MT052.U0008.TagName = "{461:";
      MT052.U000E = new SwiftTagSubItemDefinition("EmptyReport", "Empty Report");
      MT052.U0008.Elements.Add((SwiftDefinitionElement) MT052.U000E);
      MT052.U0002.Elements.Add((SwiftDefinitionElement) MT052.U0008);
      MT052.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT052.U0002);
    }

    public class DeliverySubsetStatus_336Class : SwiftTagSequence
    {
      internal override SwiftDefinitionElement Definition
      {
        get
        {
          return (SwiftDefinitionElement) MT052.U0003;
        }
      }

      [Description("")]
      public Tag1[] DeliverySubsetStatus_336_1
      {
        get
        {
          int index = -1;
          List<Tag1> list = new List<Tag1>();
          int count;
          do
          {
            ++index;
            Tag1 tag1 = new Tag1((SwiftElement) this, index, (SwiftDefinitionElement) MT052.U0004);
            count = this.ListTags((SwiftElement) tag1).Count;
            if (count > 0)
              list.Add(tag1);
          }
          while (count > 0);
          return list.ToArray();
        }
      }

      [Description("")]
      public Tag1[] Tag1_DeliverySubsetStatus_336
      {
        get
        {
          return this.DeliverySubsetStatus_336_1;
        }
      }

      internal DeliverySubsetStatus_336Class(SwiftElement parent, int index, bool createTags)
        : base(parent, index, createTags)
      {
      }

      public Tag1 AddDeliverySubsetStatus_336_1()
      {
        return new Tag1((SwiftElement) this, this.DeliverySubsetStatus_336_1.Length, (SwiftDefinitionElement) MT052.U0004)
        {
          Value = string.Empty
        };
      }

      public void RemoveDeliverySubsetStatus_336_1(Tag1 tag)
      {
        this.RemoveTag(tag.GetTag());
      }
    }
  }
}
